/*LICENSE_BEGIN
 * ******************************************************************
 * All original parts of SoccerScope2003 have copyright (2003) by
 * Team YowAI, represented by Mr. Shuhei Shiota
 * The Department of Creative Informatics
 * The Graduate School of Information Science and Technology
 * The University of Tokyo
 * 
 * Additional classes (except libraries in /lib) were developed by 
 * the Dainamite Robocup-Team of the DAI-Labor, TU-Berlin 
 * (www.dai-labor.de)
 * 
 * Extended/new classes/packages are:
 *   soccerscope.analyzer.LogfileAnalyzer
 *   soccerscope.daistatistic.*
 *   soccerscope.daistatistic.charts.*
 *   soccerscope.daistatistic.tools.*
 *   soccerscope.db.*
 *   soccerscope.dialog.*
 *   soccerscope.model.PlayerWorldModel
 *   soccerscope.model.SimplePlayer
 *   soccerscope.net.AgentConnector
 *   soccerscope.training.*
 *   soccerscope.training.conditions.*
 * ******************************************************************
LICENSE_END*/
package soccerscope.view;

import java.awt.FlowLayout;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JPanel;

/**
 * a jump button with place for more graphical components. Used to jump from one
 * Scene to another.
 * 
 */
public abstract class AbstractSceneJumper extends JPanel implements ActionListener {

    /** The Scene player, to set the new scene. */
    private ScenePlayer sPlayer;
    
    /**
     * Creates a button and add this to a panel. Furthermore the this class
     * becomes ActionListern of the Button.
     * @param The Scene player, to set the new scene
     */ 
    public AbstractSceneJumper(ScenePlayer scenePlayer) {
        sPlayer = scenePlayer;
        FlowLayout layout = new FlowLayout();
        layout.setAlignment(FlowLayout.LEFT);
        setLayout(layout);
        JButton but = new JButton("jump");
        add(but);
        but.addActionListener(this);
    }

    /**
     * Jumps to a scene given by the number.
     * @param sceneNumber the number of the scene
     */
    public void jumpToScene(int sceneNumber) {
        sPlayer.setScene(sceneNumber);
    }
    
    /**
     * Jumps to a cycle given by the number.
     * @param cycleNumber the number of the cycle
     */
    public void jumpToCycle(int cycleNumber) {
        sPlayer.skip(cycleNumber);
    }
}
